package dao.impl;

import dao.LikeDao;
import pojo.Like;

import java.sql.SQLException;
import java.util.List;

public class LikeDaoImpl extends BaseDao implements LikeDao {
    @Override
    public int saveLike(Like like) throws SQLException {
        String sql = "insert into like values(?,?)";
        return update(sql,like.getCid(),like.isPass());
    }

    @Override
    public List<Like> getAllLike() throws SQLException {
        String sql = "select * from like";
        return queryForList(Like.class,sql);
    }

    @Override
    public Like getOneLike(String cid) throws SQLException {
        String sql = "select * from like where cid = ?";
        return queryForOne(Like.class,sql,cid);
    }
}
